<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

/*
 * + Note: Phai khai bao truoc tien
 *
 * Lay ve Data
 */
global $data;
$data = $this->items;

//Khoi tao Ajax
require_once JPATH_ROOT . "/administrator/components/com_jbschedule/media/js/xajax/xajax_core/xajax.inc.php";
$xajax = new xajax();
$xajax->registerFunction("updateAssetGroups");
$xajax->processRequest();

/*
 * CallBack Function
 *
 * Tra ve HTML Option tags
 */
function updateAssetGroups(){
	global $data;

	$myResponse = new xajaxResponse();

	$output = "";
	foreach ($data as $group) {
		$output .= "<option value=\"" . $group->id . "\">" . $group->name . "</option>";
	}
	$myResponse->assign("assetgroup_id", "innerHTML", $output);

	return $myResponse;
}

exit;
?>